//
//  ContactCustomerServiceViewController.m
//  BaseFrame
//
//  Created by 吕金状 on 2017/8/10.
//  Copyright © 2017年 com.mxh. All rights reserved.
//

#import "ContactCustomerServiceViewController.h"

@interface ContactCustomerServiceViewController ()
{
    NSString *phoneNumber;
}
Strong UIView *bgView;
Strong UILabel *titleLabel;
Strong UILabel *promptLabel;
Strong UILabel *companyLabel;
Strong UILabel *recordLabel;
@end

@implementation ContactCustomerServiceViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = self.nsTitle;
    phoneNumber = @"17703199910";
    if ([self.nsTitle isEqualToString:@"投诉建议"]) {
        [self.view sd_addSubviews:@[self.titleLabel , self.promptLabel , self.bgView]];
    }else{
        [self.view sd_addSubviews:@[self.titleLabel , self.promptLabel , self.bgView , self.companyLabel, self.recordLabel]];
    }
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

//拨打电话
- (void)callPhone{
    [self callPhone:phoneNumber];
}

#pragma mark - init

- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel  = [[UILabel alloc]initWithFrame:CGRectMake(0, 0, SCREEN_WIDTH, 65 / WIDTH_5S_SCALE)];
        _titleLabel.font = [UIFont systemFontOfSize:30 weight:2];
        _titleLabel.textColor = getColor(mainColor);
        _titleLabel.textAlignment = NSTextAlignmentCenter;
        NSMutableAttributedString *attStr1 = [NSMutableAttributedString new];
        NSTextAttachment *seeAtt1 = [NSTextAttachment new];
        seeAtt1.bounds = CGRectMake(0, -7, 36, 36);
        seeAtt1.image = [UIImage imageNamed:@"ContactCustomerService_numberphone"];
        [attStr1 appendAttributedString:[NSAttributedString attributedStringWithAttachment:seeAtt1]];
        [attStr1 appendAttributedString:[[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"  %@",phoneNumber]]];
        _titleLabel.attributedText = attStr1;
        
        _titleLabel.userInteractionEnabled = YES;
        UITapGestureRecognizer *tapGesture = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(callPhone)];
        [_titleLabel addGestureRecognizer:tapGesture];
    }
    return _titleLabel;
}

- (UIView *)bgView{
    if (!_bgView) {
        _bgView = [[UIView alloc]initWithFrame:CGRectMake(0, 65 / WIDTH_5S_SCALE, SCREEN_WIDTH, 5 / WIDTH_5S_SCALE)];
        _bgView.backgroundColor = getColor(@"eeeeee");
    }
    return _bgView;
}

- (UILabel *)promptLabel{
    if (!_promptLabel) {
        _promptLabel  = [[UILabel alloc]initWithFrame:CGRectMake(30 / WIDTH_5S_SCALE, 90 / WIDTH_5S_SCALE, SCREEN_WIDTH - 60 / WIDTH_5S_SCALE, 50 / WIDTH_5S_SCALE)];
        _promptLabel.font = DEF_FontSize_17;
        _promptLabel.textColor = getColor(textColor);
        _promptLabel.numberOfLines = 0;
        _promptLabel.text = @"如果您有投诉等相关事宜的问题,请拨打以上电话!";
    }
    return _promptLabel;
}

- (UILabel *)companyLabel{
    if (!_companyLabel) {
        _companyLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - 80 / WIDTH_5S_SCALE - 64, SCREEN_WIDTH, 20 / WIDTH_5S_SCALE)];
        _companyLabel.font = DEF_FontSize_14;
        _companyLabel.textColor = getColor(textColor);
        _companyLabel.textAlignment = NSTextAlignmentCenter;
        _companyLabel.text = @"河北文扬网络科技有限公司";
    }
    return _companyLabel;
}

- (UILabel *)recordLabel{
    if (!_recordLabel) {
        _recordLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, SCREEN_HEIGHT - 60 / WIDTH_5S_SCALE - 64, SCREEN_WIDTH, 20 / WIDTH_5S_SCALE)];
        _recordLabel.font = DEF_FontSize_14;
        _recordLabel.textColor = getColor(textColor);
        _recordLabel.textAlignment = NSTextAlignmentCenter;
        _recordLabel.text = @"备案号：冀ICP备17023887号";
    }
    return _recordLabel;
}

@end
